#include "./SYSTEM/language/language.h"

static SystemLanguage_e sg_eSystemLanguage = SYSTEM_LANGUAGE_CHINESE;

const char *(sg_kSystemLanguage[TEXT_ALL])[SYSTEM_LANGUAGE_ALL] =
{
    [TEXT_MAIN_MENU] = {"主菜单", "Main Menu"},
    [TEXT_FUNCTION_SELECT] = {"功能选择", "Function Select"},

    [TEXT_RTC_CLOCK] = {"RTC时钟", "RTC Clock"},
    [TEXT_WEEK_SUNDAY] = {"星期日", "Sunday"},
    [TEXT_WEEK_MONDAY] = {"星期一", "Monday"},
    [TEXT_WEEK_TUESDAY] = {"星期二", "Tuesday"},
    [TEXT_WEEK_WEDNESDAY] = {"星期三", "Wednesday"},
    [TEXT_WEEK_THURSDAY] = {"星期四", "Thursday"},
    [TEXT_WEEK_FRIDAY] = {"星期五", "Friday"},
    [TEXT_WEEK_SATURDAY] = {"星期六", "Saturday"},

    [TEXT_PWM_SETTING] = {"PWM 设定", "PWM Setting"},
    [TEXT_FREQUENCE_MENU] = {"频率", "Fre"},
    [TEXT_DUTY_MENU] = {"占空比", "Duty"},

    [TEXT_SINE_WAVE_SETTING] = {"正弦波", "Sine Wave"},
    [TEXT_SINEWAVE_FREQ_MENU] = {"频率", "Freq"},
    [TEXT_SINEWAVE_AMP_MENU] = {"幅值", "Amp"},
    [TEXT_SINEWAVE_PHASE_MENU] = {"相位", "Phase"},

    [TEXT_DISPLAY_SETTING] = {"显示设定", "Display Setting"},
    [TEXT_DIRECTION] = {"屏幕方向", "Direction"},
    [TEXT_ROTATE_0] = {"0°", "0°"},
    [TEXT_ROTATE_90] = {"90°", "90°"},
    [TEXT_ROTATE_180] = {"180°", "180°"},
    [TEXT_ROTATE_270] = {"270°", "270°"},
    [TEXT_PORTRAIT_NORMAL] = {"竖屏正向", "Portrait Normal"},
    [TEXT_LANDSCAPE_NORMAL] = {"横屏正向", "Landscape Normal"},
    [TEXT_PORTRAIT_REVERSED] = {"竖屏反向", "Portrait Reversed"},
    [TEXT_LANDSCAPE_REVERSED] = {"横屏反向", "Landscape Reversed"},
    [TEXT_BRIGHTNESS] = {"屏幕亮度", "Brightness"},
    [TEXT_BRIGHTNESS_20] = {"亮度 20%", "Bright 20%"},
    [TEXT_BRIGHTNESS_40] = {"亮度 40%", "Bright 40%"},
    [TEXT_BRIGHTNESS_60] = {"亮度 60%", "Bright 60%"},
    [TEXT_BRIGHTNESS_80] = {"亮度 80%", "Bright 80%"},
    [TEXT_BRIGHTNESS_100] = {"亮度100%", "Bright 100%"},
    [TEXT_LANGUAGE] = {"语言", "Language"},
    [TEXT_CHINESE] = {"中文", "Chinese"},
    [TEXT_ENGLISH] = {"英文", "English"},

    [TEXT_RESET_DEFAULT] = {"恢复默认", "Reset Default"},
    [TEXT_BACK] = {"返回", "Back"},
    [TEXT_DS18B20_TEMP] = {"DS18B20", "DS18B20"},
    [TEXT_DHT11_TEMP_HUMI] = {"DHT11", "DHT11"},
    
};

void set_language(SystemLanguage_e lang)
{
    if (lang < SYSTEM_LANGUAGE_ALL)
    {
        sg_eSystemLanguage = lang;
    }
}


const char *get_text(TextId_e id)
{
    static const char *pszNullString = "N/A";

    if (id < TEXT_ALL)
    {
        return sg_kSystemLanguage[id][sg_eSystemLanguage];
    }

    return pszNullString; /* 未找到对应的文本 */
}

const char *get_text_by_language(SystemLanguage_e lang, TextId_e id)
{
    static const char *pszNullString = "N/A";

    if (id < TEXT_ALL)
    {
        return sg_kSystemLanguage[id][lang];
    }

    return pszNullString; /* 未找到对应的文本 */
}
